package dataStream;

import java.util.Objects;

/**
 * @desc
 * @Author xuyouchang
 * @Date 2021/10/9
 */
public class Person{
    public String gender;
    public Integer age;
    public long timestamp;

    public Person() {}
    public Person(String gender, Integer age) {
        this.gender = gender;
        this.age = age;
    }

    public Person(String gender, Integer age, long timestamp) {
        this.gender = gender;
        this.age = age;
        this.timestamp = timestamp;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return timestamp == person.timestamp && Objects.equals(gender, person.gender) && Objects.equals(age, person.age);
    }

    @Override
    public int hashCode() {
        return Objects.hash(gender, age, timestamp);
    }

    @Override
    public String toString() {
        return "Person{" +
                "gender='" + gender + '\'' +
                ", age=" + age +
                ", timestamp=" + timestamp +
                '}';
    }
}
